#ifndef CCONNECTHANDL_H
#define CCONNECTHANDL_H
#include<boost\asio.hpp>
#include<vector>
#include"Packet.h"
namespace yssdk
{

#define bufferSize 2048
    class CNet;
    class CConnectHandl:public boost::asio::ip::tcp::socket
    {
    public:
        CNet                *m_net;
        int UID;
        unsigned char buffer[bufferSize];
        netstream *bufferstream;
        void PushStream(int size);
        bool PopMsg(unsigned char*,int size);
        unsigned char * GetMsg();
        void ZeroBuffer()
        {
            ZeroMemory(buffer,bufferSize);
        }
        void readIo();
        void readComplete(const boost::system::error_code& error,
            size_t bytes_transferred);

        void SendIo(Message*);
        void SendComplete(Message*,const boost::system::error_code& error);
        CConnectHandl( CNet *net,int uid,boost::asio::io_service &iorun);
        ~CConnectHandl(void);
    };

}
#endif // CCONNECTHANDL_H
